
*************** The do file first runs the main text analyses, and then the Supplementary Material analyses 
log using log, replace
set maxvar 10000
set scheme stcolor

*This do file requires outreg2, ebalance, fre, coefplot, and ipfweight. 
*If not installed, uncomment and run the following:

/*
ssc install outreg2
ssc install ebalance
ssc install coefplot
ssc install ipfweight
ssc install fre
*/


*creating rescale program
program rescale
  args oldvar newmin newmax
  qui sum `oldvar'
  local oldmin=r(min)
  local rangequota=(`newmax'-`newmin')/(r(max)-r(min))
  replace `oldvar'=(`oldvar'-`oldmin')*`rangequota'+`oldmin'+(`newmin'-`oldmin')
end

*loading dataset 
*cd "YOUR_DIRECTORY_HERE"
use "AB_cps_trimmed.dta", clear


****Vote buying exposure
*2010 (code any exposure to 1, and code no exposure to 0)
recode clien1 (1/2=1)(3=0), gen(client3)
lab var client3 "Vote Buying Target"
*2014 direct
recode clien1na (2=0), gen(client)
lab var client "Vote Buying Target (direct measure)"
*2014 indirect
recode clien1n (2=0), gen(indirect)
lab var indirect "Vote Buying Target (indirect)"

*combining direct vote buying exposure to range across years
tab client3 wave // 2010-2
	tab client wave // 2014~
	tab indirect wave // same
egen direct = rowtotal(client3 client)
replace direct=. if client>1 & client3>1
lab var direct "Vote Buying Target (direct)"

***combining trust in elections to range across years
tab b47a b47 // no obs
	tab b47a wave // from 2012, other than ecuador
	tab b47 wave // ~2010
egen trustel = rowtotal(b47a b47)
	replace trustel=. if missing(b47) & missing(b47a)
	tab trustel wave
	
***approval of vote buying (2018 data only)
egen approval=rowtotal(clien4 clien4a clien4b)
	replace approval=. if missing(clien4) & missing(clien4a) & missing(clien4b)
	rescale approval 1 0 // to run from strongly disagree(0) to strongly agree (1)

****controls
rescale quintall 0 1
rescale edr 0 1
rescale m1 1 0
recode q1 (1=0)(2=1)(3=0), gen(woman)
	tab woman q1, mis
recode q2 (16/25=0)(26/35=1)(36/45=2)(46/55=3)(56/65=4)(66/112=5), gen(agecohort)
	rescale agecohort 0 1
	lab def agecohort 0 "16-25" 1 "66+"
	lab val agecohort agecohort
	fre agecohort

*ur is coded so that 1=urban, 2=rural*
recode ur 1=0 2=1, gen(rural)

*** labels
lab var indirect "Indirect Exposure"
lab var direct "Direct Exposure"
lab var approval "Approval of Vote Buying"
lab var rural "Rural"
lab var woman "Woman"
lab var edr "Education"
lab var quintall "Wealth"

***************************************************************** Main text analyses 
cd "../figures and tables"

*** Table 1
*unmatched
svy: reg trustel indirect woman quintall agecohort edr rural m1 i.pais if wave==2014  
	outreg2 using table1.doc, dec(2) drop (i.pais) replace ctitle(Indirect, unmatched)
svy: reg trustel direct woman quintall agecohort edr rural m1 i.pais if wave==2014  
	outreg2 using table1.doc, dec(2) drop (i.pais) append ctitle(Direct, unmatched)
*matched
ebalance indirect woman quintall agecohort edr rural i.pais if wave==2014, tar(3) gen(indirectwt)
ebalance direct woman quintall agecohort edr rural i.pais if wave==2014, tar(3) gen(directwt)
reg trustel indirect woman quintall agecohort edr rural m1 i.pais if wave==2014 [iweight=indirectwt]
	outreg2 using table1.doc, dec(2) append ctitle(Indirect, matched) drop(i.pais)
reg trustel direct woman quintall agecohort edr rural m1 i.pais if wave==2014 [iweight=directwt]
	outreg2 using table1.doc, dec(2) append ctitle(Direct, matched) drop(i.pais)

	
				
*** Figure 1
* Quintiles of approval
sum approval, detail
	sum approval if !missing(trustel, indirect, approval, woman, quintall, agecohort, edr, rural, m1), detail
	sum approval if !missing(trustel, direct, approval, woman, quintall, agecohort, edr, rural, m1), detail
	// 25%=0, 50%=.25, 75%=.5, 95~100%=1
	recode approval (0=0 "25%")(.25=1 "50%")(.5=2 "75%")(.75 1=3 "100%"), gen(approval_percentiles)
	lab var approval_percentiles "Approval of Vote Buying, Quintiles"
* figure
mixed trustel i.indirect##c.approval_percentiles woman quintall agecohort edr rural m1 || pais: 
	margins, dydx(indirect) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Indirect Exposure to Vote Buying")
	graph save Graph "fig1_indirect.gph", replace			
mixed trustel i.direct##c.approval_percentiles woman quintall agecohort edr rural m1 || pais: 
	margins, dydx(direct) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Direct Exposure to Vote Buying")
	graph save Graph "fig1_direct.gph", replace		
graph combine fig1_direct.gph fig1_indirect.gph, xsize(8) ysize(4) title("")
graph save Graph "fig1.gph", replace

* figure note interquartile difference analysis
mixed trustel i.indirect##c.approval woman quintall agecohort edr rural m1 || pais: 
	margins, dydx(indirect) at(approval=(0 .5)) 
	// diff= -.041, standard error=.083, z-statistic=-.494, one-sided p-value=.311
mixed trustel i.direct##c.approval woman quintall agecohort edr rural m1 || pais: 
	margins, dydx(direct) at(approval=(0 .5))
	// diff=-.072, se=.103, z=.699, one-sided p-value=.242


*** Experiment analyses for Table 2 and Figure 2
import delimited "../data/mex_experiment_cps.csv", clear
destring, replace

*dropping invalid responses
note q2: "Consent"
	drop if q2!=1 
note citizenship: "Mexican citizen"
	drop if citizenship!=1 
note birth: "How old are you? [in years]"
	drop if birth==1

*creating treatment variable using a timer item that was only measured for treated
gen treat=.
replace treat=1 if q78_firstclick!=.
replace treat=0 if q78_firstclick==.

*norms
recode norms1 (1=5)(2=4)(4=2)(5=1)
	recode norms2 (1=5)(2=4)(4=2)(5=1)
	lab define approve1 5"Strongly approve" 4"Approve" 3"Do not approve but understand" 2"Disapprove" 1"Strongly disapprove"
	lab val norms1 approve1
	lab val norms2 approve1
	lab var norms1 "Approve parties buying votes"
	lab var norms2 "Approve voters selling votes"
gen norm=(norms1+norms2)/2
rescale norm 0 1

*trust in elections
tab b47a
gen trustel=b47a-1

*saturation
note exp1c: "Have you seen news stories like this before?"
gen unsaturated=1
replace unsaturated=0 if exp1c==1
recode exp1c(2=0)

*creating variable excluding those who took less than .3 seconds per word for shortest way through survey (faster than approximately 427 seconds)
tab durationinseconds if etid!=. | religid!=. // fastest 2.43% categorized as speeders using this cutoff
gen speed=0
replace speed=1 if durationinseconds<427

*Table 2
ttest trustel, by(treat) 
ttest trustel if speed==0, by(treat)
ttest trustel if exp1c!=1, by(treat)

*Figure 2
* Quintiles of approval
sum norm, detail
	sum norm if !missing(trustel, treat), detail
	sum norm if !missing(trustel, treat, exp1c), detail
	// 25%=0, 50%=.25, 75%=.5, 99-100%=1
fre norm
	recode norm (0=0 "25%")(.125/.25=1 "50%")(.375/.5=2 "75%")(.625/1=3 "100%"), gen(norm_percentiles)
	lab var norm_percentiles "Approval of Vote Buying, Quintiles"
	
* figure
reg trustel c.norm_percentiles##i.treat
	margins, dydx(treat) at(norm_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Full Sample")
	graph save Graph "fig2_full.gph", replace		
reg trustel c.norm_percentiles##i.treat if exp1c!=1 
	margins, dydx(treat) at(norm_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Unsaturated Sample")
	graph save Graph "fig2_unsat.gph", replace
graph combine fig2_full.gph fig2_unsat.gph, xsize(8) ysize(4) title("")
	graph save Graph "fig2.gph", replace
	
* figure note
reg trustel c.norm_percentiles##i.treat
	margins, dydx(treat) at(norm_percentiles=(0 2)) post coefl
	lincom _b[1.treat:2._at] - _b[1.treat:1bn._at] // 25 vs 75%
reg trustel c.norm_percentiles##i.treat if exp1c!=1 
	margins, dydx(treat) at(norm_percentiles=(0 2)) post coefl
	lincom _b[1.treat:2._at] - _b[1.treat:1bn._at] // 25 vs 75%
	
********************************************************* Appendix analyses for AB 

cd "../data"
use "AB_cps_trimmed.dta", clear
preserve
	do vdem.do // recoding vdem data sets for merge
restore
merge m:m pais wave using "vdem" // merging vdem data set
cd "../figures and tables"

****Vote buying exposure
*2010 (code any exposure to 1, and code no exposure to 0)
recode clien1 (1/2=1)(3=0), gen(client3)
lab var client3 "Vote Buying Target"
*2014 direct
recode clien1na (2=0), gen(client)
lab var client "Vote Buying Target (direct measure)"
*2014 indirect
recode clien1n (2=0), gen(indirect)
lab var indirect "Vote Buying Target (indirect)"

*combining direct vote buying exposure to range across years
tab client3 wave // 2010-2
	tab client wave // 2014~
	tab indirect wave // same
egen direct = rowtotal(client3 client)
replace direct=. if client>1 & client3>1
lab var direct "Vote Buying Target (direct)"

***combining trust in elections to range across years
tab b47a b47 // no obs
	tab b47a wave // from 2012, other than ecuador
		tab b47a pais if wave==2004 // ecuador 
		tab pais b47 if wave==2004 // ecuador not included
	tab b47 wave // ~2010
egen trustel = rowtotal(b47a b47)
	replace trustel=. if missing(b47) & missing(b47a)
	tab trustel wave

***approval of vote buying
tab1 clien4 clien4a clien4b // all same qs
	tab pais clien4 // nicaragua
	tab pais clien4a // mexico, guatemala, peru, paraguay, dominican, jamaica
	tab pais clien4b // same
	tab clien4a clien4b // no obs
	tab clien4a clien4b, mis
egen approval=rowtotal(clien4 clien4a clien4b)
	sum clien4 clien4a clien4b
	tab approval // runs from strongly agree to strongly disagree
	recode approval (0=.)
	rescale approval 1 0 // to run from strongly disagree(0) to strongly agree (1)

***control variables
recode q1 (1=0)(2=1)(3=0), gen(woman)
	tab woman q1, mis
recode q2 (16/25=0)(26/35=1)(36/45=2)(46/55=3)(56/65=4)(66/112=5), gen(agecohort)
recode ur 1=0 2=1, gen(rural)
	label variable rural "Rural"
	
****rescaling 
rescale agecohort 0 1 
	lab def agecohort 0 "16-25" 1 "66+"
	lab val agecohort agecohort
rescale quintall 0 1
rescale edr 0 1
rescale m1 1 0 // presidential approval
rescale ing4 0 1 // support for democracy
rescale exc7new 0 1 // perceived degree of corruption among politicians
rescale idio2 0 1 // perception of personal econ situation, from better to worse
rescale soct2 0 1 // perception of country's econ situation, from better to worse
rescale psa5 0 1 // trust in institutions

*adding months from most recent election date
gen months=.
replace months=6 if pais==1 & wave==2010
	replace months=18 if pais==1 & wave==2014
	replace months=6 if pais==1 & wave==2018
replace months=27 if pais==2 & wave==2010
	replace months=31 if pais==2 & wave==2014
	replace months=37 if pais==2 & wave==2018
replace months=11 if pais==3 & wave==2010
	replace months=1 if pais==3 & wave==2014
	replace months=7 if pais==3 & wave==2016
	replace months=8 if pais==3 & wave==2018
replace months=4 if pais==4 & wave==2014
	replace months=11 if pais==4 & wave==2018
replace months=39 if pais==5 & wave==2010
	replace months=27 if pais==5 & wave==2014
	replace months=56 if pais==5 & wave==2016
replace months=0 if pais==6 & wave==2010
	replace months=1 if pais==6 & wave==2014
replace months=9 if pais==7 & wave==2010
	replace months=58 if pais==7 & wave==2014
replace months=45 if pais==8 & wave==2010
	replace months=46 if pais==8 & wave==2014
	replace months=3 if pais==8 & wave==2018
replace months=10 if pais==9 & wave==2010
	replace months=11 if pais==9 & wave==2014
replace months=2 if pais==10 & wave==2010
	replace months=52 if pais==10 & wave==2014
replace months=43 if pais==11 & wave==2010
	replace months=31 if pais==11 & wave==2014
	replace months=32 if pais==11 & wave==2018
replace months=21 if pais==12 & wave==2010
	replace months=9 if pais==12 & wave==2014
	replace months=42 if pais==12 & wave==2016
	replace months=10 if pais==12 & wave==2018
replace months=5 if pais==13 & wave==2010
	replace months=4 if pais==13 & wave==2014
replace months=4 if pais==14 & wave==2010
	replace months=52 if pais==14 & wave==2014
replace months=41 if pais==15 & wave==2010
	replace months=41 if pais==15 & wave==2014
replace months=37 if pais==16 & wave==2010
	replace months=11 if pais==16 & wave==2014
replace months=9 if pais==17 & wave==2010
	replace months=5 if pais==17 & wave==2014
replace months=20 if pais==21 & wave==2010
	replace months=22 if pais==21 & wave==2014
	replace months=35 if pais==21 & wave==2018
replace months=35 if pais==22 & wave==2014
replace months=29 if pais==23 & wave==2010
	replace months=26 if pais==23 & wave==2014
	replace months=36 if pais==23 & wave==2018
replace months=41 if pais==24 & wave==2010
	replace months=31 if pais==24 & wave==2014
replace months=23 if pais==25 & wave==2010
replace months=25 if pais==26 & wave==2010
	replace months=26 if pais==26 & wave==2014	
	
***A3: summary statistics
gen vbmeasured=0
	replace vbmeasured=1 if !missing(indirect) | !missing(direct)
	tab indirect direct if vbmeasured==0, mis
	tab indirect direct if vbmeasured==1, mis
sum trustel woman quintall agecohort edr rural m1 direct indirect ///
	if !missing(trustel, woman, quintall, agecohort, edr, rural, m1) & vbmeasured==1 & wave==2014


***A4: propensity matching for table 1
teffects psmatch (trustel) (direct rural woman agecohort edr quintall i.pais m1) if wave==2014, nneighbor(3)
			outreg2 using a4.doc, dec(2) replace ctitle(Direct)
teffects psmatch (trustel) (indirect rural woman agecohort edr quintall i.pais m1) if wave==2014, nneighbor(3)
			outreg2 using a4.doc, dec(2) append ctitle(Indirect)
			

***A5: showing balance for table 1 matching
ebalance direct woman quintall agecohort edr rural i.pais if wave==2014, tar(3) gen(directwt)
	ebalance indirect woman quintall agecohort edr rural i.pais if wave==2014, tar(3) gen(indirectwt)
sum direct indirect if wave==2014
	sum direct [aweight=directwt] if wave==2014
	sum indirect [aweight=indirectwt] if wave==2014


***A6: table 1 analysis for other years (direct exposure)
svy: reg trustel direct woman quintall agecohort edr rural m1 i.pais i.wave 
	outreg2 using a6.doc, dec(2) replace ctitle(Pooled) drop(i.pais)
svy: reg trustel direct woman quintall agecohort edr rural m1 i.pais if wave==2010
	outreg2 using a6.doc, dec(2) append ctitle(2010) drop(i.pais)
svy: reg trustel direct woman quintall agecohort edr rural m1 i.pais if wave==2012
	outreg2 using a6.doc, dec(2) append ctitle(2012) drop(i.pais)
svy: reg trustel direct woman quintall agecohort edr rural m1 i.pais if wave==2016
	outreg2 using a6.doc, dec(2) append ctitle(2016) drop(i.pais)
svy: reg trustel direct woman quintall agecohort edr rural m1 i.pais if wave==2018
	outreg2 using a6.doc, dec(2) append ctitle(2018) drop(i.pais)
		

***A7: table 1 analysis for other years (indirect exposure)
svy: reg trustel indirect woman quintall agecohort edr rural m1 i.pais i.wave
	outreg2 using a7.doc, dec(2) replace ctitle(Pooled) drop(i.pais)
svy: reg trustel indirect woman quintall agecohort edr rural m1 i.pais if wave==2016
	outreg2 using a7.doc, dec(2) append ctitle(2016) drop(i.pais)
svy: reg trustel indirect woman quintall agecohort edr rural m1 i.pais if wave==2018
	outreg2 using a7.doc, dec(2) append ctitle(2018) drop(i.pais)


***A8: table 1 analysis, multilevel
mixed trustel indirect woman quintall agecohort edr rural m1 if wave==2014 || pais: 
			outreg2 using a8.doc, dec(2) replace ctitle(Indirect)
mixed trustel direct woman quintall agecohort edr rural m1 if wave==2014 || pais: 
			outreg2 using a8.doc, dec(2) append ctitle(Direct)
	
	
***A9: table 1 analysis controlling for support for democracy
*unmatched
svy: reg trustel indirect woman quintall agecohort edr rural m1 ing4 i.pais if wave==2014
	outreg2 using a9.doc, dec(2) replace ctitle(Indirect, unmatched) drop(i.pais)
svy: reg trustel direct woman quintall agecohort edr rural m1 ing4 i.pais if wave==2014
	outreg2 using a9.doc, dec(2) append ctitle(Direct, unmatched) drop(i.pais)
*matched
reg trustel indirect woman quintall agecohort edr rural m1 ing4 i.pais if wave==2014 [iweight=indirectwt]
	outreg2 using a9.doc, dec(2) append ctitle(Indirect, matched) drop(i.pais)
reg trustel direct woman quintall agecohort edr rural m1 ing4 i.pais if wave==2014 [iweight=directwt]
	outreg2 using a9.doc, dec(2) append ctitle(Direct, matched) drop(i.pais)
	
	
***A10: country-by-country analysis for H1, direct
svy: reg trustel direct woman quintall agecohort edr rural m1 if wave==2014 & pais==1
	outreg2 using a10.doc, dec(2) replace ctitle(Mexico)
levelsof pais if wave==2014 & !missing(trustel, indirect) & pais>1, local(2014direct)
foreach x in `2014direct' {
		svy: reg b47a direct woman quintall agecohort edr rural m1 if wave==2014 & pais==`x'
		outreg2 using a10.doc, dec(2) append ctitle(`x')
}
	
***A11: country-by-country analysis for H1, indirect
svy: reg trustel indirect woman quintall agecohort edr rural m1 if wave==2014 & pais==1
	outreg2 using a11.doc, dec(2) replace ctitle(Mexico)
levelsof pais if wave==2014 & !missing(trustel, indirect) & pais>1, local(2014indirect)
foreach x in `2014indirect' {
		svy: reg b47a indirect woman quintall agecohort edr rural m1 if wave==2014 & pais==`x'
		outreg2 using a11.doc, dec(2) append ctitle(`x')
}

***A12: months by country
tab pais months if wave==2014


***A13: moderation by months
mixed trustel i.indirect##c.months woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a13.doc, dec(2) replace ctitle(Indirect)
			margins, dydx(indirect) at(months=(0(15)60))
				marginsplot, xtitle(Months After Election) ///
					ytitle("Predicted Electoral Trust 2014, indirect") ///
					title("Indirect Exposure to Vote Buying")
				graph save Graph "months_inter2014_dydx.gph", replace
mixed trustel i.direct##c.months woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a13.doc, dec(2) append ctitle(Direct)
			margins, dydx(direct) at(months=(0(15)60))
				marginsplot, xtitle(Months After Election) ///
					ytitle("Effects on Trust 2014, direct") yline(0)  ///
					title("Indirect Exposure to Vote Buying")
				graph save Graph "months_inter2014_direct_dydx.gph", replace				
graph combine months_inter2014_direct_dydx.gph months_inter2014_dydx.gph
	graph save Graph "a13.gph", replace


***A14: moderation by electoral violence
mixed trustel i.indirect##c.elviolence woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a14.doc, dec(2) replace ctitle(Indirect)
	margins, dydx(indirect) at(elviolence=(0(.25)1))
	marginsplot, xtitle(Electoral Violence) ///
		ytitle(Effects on Electoral Trust) ///
		title(Indirect Exposure to Vote Buying) yline(0)
	graph save Graph "elviolence_indirect.gph", replace				
mixed trustel i.direct##c.elviolence woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a14.doc, dec(2) append ctitle(Direct)
	margins, dydx(direct) at(elviolence=(0(.25)1)) 
	marginsplot, xtitle(Electoral Violence) ///
		ytitle(Effects on Electoral Trust) ///
		title(Direct Exposure to Vote Buying) yline(0)
	graph save Graph "elviolence_direct.gph", replace
graph combine elviolence_direct.gph elviolence_indirect.gph
	graph save Graph "a14.gph", replace
	
	
***A15: moderation by voting irregularities
mixed trustel i.indirect##c.irregularities woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a15.doc, dec(2) replace ctitle(Indirect)
	margins, dydx(indirect) at(irregularities=(0(.25)1))
	marginsplot, xtitle(Voting Irregularities) ///
		ytitle(Effects on Electoral Trust) ///
		title(Indirect Exposure to Vote Buying) yline(0)
	graph save Graph "irregularities_indirect.gph", replace				
mixed trustel i.direct##c.irregularities woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a15.doc, dec(2) append ctitle(Direct)
	margins, dydx(direct) at(irregularities=(0(.25)1)) 
	marginsplot,  xtitle(Voting Irregularities) ///
		ytitle(Effects on Electoral Trust) ///
		title(Direct Exposure to Vote Buying) yline(0)
	graph save Graph "irregularities_direct.gph", replace
graph combine irregularities_direct.gph irregularities_indirect.gph
	graph save Graph "a15.gph", replace

	
***A16: moderation by government intimidation
mixed trustel i.indirect##c.govtintimidation woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a16.doc, dec(2) replace ctitle(Indirect)
	margins, dydx(indirect) at(govtintimidation=(0(.25)1))
	marginsplot, xtitle(Government Intimidation) ///
		ytitle(Effects on Electoral Trust) ///
		title(Indirect Exposure to Vote Buying) yline(0)
	graph save Graph "govtintimidation_indirect.gph", replace				
mixed trustel i.direct##c.govtintimidation woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
			outreg2 using a16.doc, dec(2) append ctitle(Direct)
	margins, dydx(direct) at(govtintimidation=(0(.25)1)) 
	marginsplot, xtitle(Government Intimidation) ///
		ytitle(Effects on Electoral Trust) ///
		title(Direct Exposure to Vote Buying) yline(0)
	graph save Graph "govtintimidation_direct.gph", replace
graph combine govtintimidation_direct.gph govtintimidation_indirect.gph
	graph save Graph "a16.gph", replace

	
***A17: moderation by particularistic goods
mixed trustel i.indirect##c.particular woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a17.doc, dec(2) replace ctitle(Indirect)
	margins, dydx(indirect) at(particular=(0(.25)1))
	marginsplot, yline(0) ///
		xtitle(Prevalence of Particularistic Goods) ///
		ytitle(Effects on Trust in Elections) ///
		title(Indirect Exposure to Vote Buying)
	graph save Graph "fig1particular_indirect.gph", replace				
mixed trustel i.direct##c.particular woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a17.doc, dec(2) append ctitle(Direct)
	margins, dydx(direct) at(particular=(0(.25)1)) 
	marginsplot, yline(0) ///
		xtitle(Prevalence of Particularistic Goods) ///
		ytitle(Effects on Trust in Elections) ///
		title(Direct Exposure to Vote Buying)
	graph save Graph "fig1particular_direct.gph", replace
graph combine fig1particular_direct.gph fig1particular_indirect.gph
	graph save Graph "a17.gph", replace

	
***A18: moderation by clientelist linkages
mixed trustel i.indirect##c.clientelist woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a18.doc, dec(2) replace ctitle(Indirect)
	margins, dydx(indirect) at(clientelist=(0(.25)1))
	marginsplot, yline(0) ///
		xtitle(Prevalence of Clientelistic Party Linkages) ///
		ytitle(Effects on Trust in Elections) ///
		title(Indirect Exposure to Vote Buying)
	graph save Graph "fig1clientelist_indirect.gph", replace				
mixed trustel i.direct##c.clientelist woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a18.doc, dec(2) append ctitle(Direct)
	margins, dydx(direct) at(clientelist=(0(.25)1)) 
	marginsplot, yline(0) ///
		xtitle(Prevalence of Clientelistic Party Linkages) ///
		ytitle(Effects on Trust in Elections) ///
		title(Direct Exposure to Vote Buying)
	graph save Graph "fig1clientelist_direct.gph", replace
graph combine fig1clientelist_direct.gph fig1clientelist_indirect.gph
	graph save Graph "a18.gph", replace


***A19: moderation by vote buying prevalence
mixed trustel i.indirect##c.vbuy woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a19.doc, dec(2) replace ctitle(Indirect)
	margins, dydx(indirect) at(vbuy=(0(.25)1))
	marginsplot, yline(0) ///
		xtitle("Prevalence of Vote Buying, Vdem") ///
		ytitle(Effects on Trust in Elections) ///
		title(Indirect Exposure to Vote Buying)
	graph save Graph "fig1vbuy_indirect.gph", replace				
mixed trustel i.direct##c.vbuy woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a19.doc, dec(2) append ctitle(Direct)
	margins, dydx(direct) at(vbuy=(0(.25)1)) 
	marginsplot, yline(0) ///
		xtitle("Prevalence of Vote Buying, Vdem") ///
		ytitle(Effects on Trust in Elections) ///
		title(Direct Exposure to Vote Buying)
	graph save Graph "fig1vbuy_direct.gph", replace
graph combine fig1vbuy_direct.gph fig1vbuy_indirect.gph
	graph save Graph "a19.gph", replace
	
	
***A21: predictors of norms (AB 2018) // results don't change if using idio2 and soct2 as categorical variables in its original scale
svy: reg approval woman quintall agecohort edr rural i.pais if wave==2018
	outreg2 using a21_1.doc, dec(2) replace ctitle(Demographics) drop(i.pais)
svy: reg approval woman quintall agecohort edr rural m1 ing4 i.pais if wave==2018
	outreg2 using a21_1.doc, dec(2) append ctitle(+m1 and ing4) drop(i.pais)
svy: reg approval woman quintall agecohort edr rural m1 ing4 idio2 soct2 exc7new i.pais if wave==2018
	outreg2 using a21_1.doc, dec(2) append ctitle(+econ and corrupt) drop(i.pais)
svy: reg approval woman quintall agecohort edr rural m1 ing4 idio2 soct2 exc7new psa5 i.pais if wave==2018
	outreg2 using a21_1.doc, dec(2) append ctitle(Full) drop(i.pais)

gen winner=.
replace winner=0 if !missing(vb3n_18) // voted but lost
replace winner=0 if vb2==2 // non-voters
replace winner=1 if pais==1 & vb3n_18==101
replace winner=1 if pais==2 & vb3n_18==201
replace winner=1 if pais==11 & vb3n_18==1101
replace winner=1 if pais==12 & vb3n_18==1201
replace winner=1 if pais==21 & vb3n_18==2101
replace winner=1 if pais==23 & vb3n_18==2302
	
svy: reg approval woman quintall agecohort edr rural i.pais if wave==2018
	outreg2 using a21_2.doc, dec(2) replace ctitle(Demographics) drop(i.pais)
svy: reg approval woman quintall agecohort edr rural winner ing4 i.pais if wave==2018
	outreg2 using a21_2.doc, dec(2) append ctitle(+winner and ing4) drop(i.pais)
svy: reg approval woman quintall agecohort edr rural winner ing4 idio2 soct2 exc7new i.pais if wave==2018
	outreg2 using a21_2.doc, dec(2) append ctitle(+econ and corrupt) drop(i.pais)
svy: reg approval woman quintall agecohort edr rural winner ing4 idio2 soct2 exc7new psa5 i.pais if wave==2018
	outreg2 using a21_2.doc, dec(2) append ctitle(Full) drop(i.pais)


***A22: profile analysis based on A21 // re-load data set so variables are not rescaled to include non-integer values (for margins)
preserve
	use "../data/AB_cps_trimmed.dta", clear
	recode clien1 (1/2=1)(3=0), gen(client3)
	recode clien1na (2=0), gen(client)
	recode clien1n (2=0), gen(indirect)
	egen direct = rowtotal(client3 client)
		replace direct=. if client>1 & client3>1
	egen trustel = rowtotal(b47a b47)
		replace trustel=. if missing(b47) & missing(b47a)
	egen approval=rowtotal(clien4 clien4a clien4b)
		sum clien4 clien4a clien4b
		tab approval // runs from strongly agree to strongly disagree
		recode approval (0=.)
		rescale approval 1 0 // to run from strongly disagree(0) to strongly agree (1)
	recode ur 1=0 2=1, gen(rural)
	recode q2 (16/25=0)(26/35=1)(36/45=2)(46/55=3)(56/65=4)(66/112=5), gen(agecohort)
		fre agecohort
	recode q1 (1=0)(2=1)(3=0), gen(woman)
		tab woman q1, mis

	svy: reg approval i.woman i.quintall i.agecohort i.edr i.rural m1 ing4 i.idio2 i.soct2 exc7new psa5 i.pais
	margins woman // male slightly (.02) more likely approvers
	margins rural // rural 
	margins quintall // 2, then 3
	margins agecohort // 1, then 0
	margins edr
	margins, at(m1=(1(1)5)) // 1 (very good)
	margins, at(psa5=(0(25)100)) // 100
	*non-approver profile: margins, at(rural=0 woman=1 agecohort=5 edr=3 quintall=5 m1=5 psa5=0)
	*approver profile: margins, at(rural=1 woman=0 agecohort=1 edr=1 quintall=2 m1=1 psa5=100)

	svy: reg trustel direct woman quintall agecohort edr rural m1 ing4 psa5 i.idio2 i.soct2 i.pais if wave==2014 
		margins, at(direct=0 rural=1 woman=0 agecohort=1 edr=1 quintall=2 m1=1 psa5=100) atmeans post // approver, no exposure
		eststo m1
	svy: reg trustel direct woman quintall agecohort edr rural m1 ing4 psa5 i.idio2 i.soct2 i.pais if wave==2014
		margins, at(direct=1 rural=1 woman=0 agecohort=1 edr=1 quintall=2 m1=1 psa5=100) atmeans post // approver, vb exposure
		eststo m2
	svy: reg trustel direct woman quintall agecohort edr rural m1 ing4 psa5 i.idio2 i.soct2 i.pais if wave==2014
		margins, at(direct=0 rural=0 woman=1 agecohort=5 edr=3 quintall=5 m1=5 psa5=0) atmeans post // non-approver, no exposure
		eststo m3
	svy: reg trustel direct woman quintall agecohort edr rural m1 ing4 psa5 i.idio2 i.soct2 i.pais if wave==2014
		margins, at(direct=1 rural=0 woman=1 agecohort=5 edr=3 quintall=5 m1=5 psa5=0) atmeans post // non-approver, vb exposure
		eststo m4
	coefplot m1 m2 m3 m4
restore


*** A20
*DALP data set for merging
preserve
	use "../data/countrylevel_20130907.dta", clear
	tab b6
	gen pais=.
		replace pais=1 if country=="Mexico"
		replace pais=2 if country=="Guatemala"
		replace pais=3 if country=="El Salvador"
		replace pais=4 if country=="Honduras"
		replace pais=5 if country=="Nicaragua"
		replace pais=6 if country=="Costa Rica"
		replace pais=7 if country=="Panama"
		replace pais=8 if country=="Colombia"
		replace pais=9 if country=="Ecuador"
		replace pais=10 if country=="Bolivia"
		replace pais=11 if country=="Peru"
		replace pais=12 if country=="Paraguay"
		replace pais=13 if country=="Chile"
		replace pais=14 if country=="Uruguay"
		replace pais=15 if country=="Brazil"
		replace pais=16 if country=="Venezuela"
		replace pais=17 if country=="Argentina"
		replace pais=21 if country=="Dom. Rep." 
		replace pais=23 if country=="Jamaica"
	drop if missing(pais) // Belize, Guyana, Haiti missing from DALP
	rename b6 vb_dalp
	keep pais vb_dalp
	save "../data/dalp.dta", replace
restore
	
*** Figure
merge m:m pais using "../data/dalp.dta", gen(merge_dalp) // merging dalp data set
gen dalp=vb_dalp
rescale dalp 0 1
mixed trustel i.indirect##c.dalp woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a20.doc, dec(2) replace ctitle(Indirect)
	margins, dydx(indirect) at(dalp=(0(.25)1))
	marginsplot, yline(0) ///
		xtitle("Inducing votes with targeted benefits, DALP") ///
		ytitle("Effects on Trust in Elections") ///
		title(Indirect Exposure to Vote Buying)
	graph save Graph "fig1dalp_indirect.gph", replace				
mixed trustel i.direct##c.dalp woman quintall agecohort edr rural m1 if wave==2014 [pweight = weight1500] || pais: 
	outreg2 using a20.doc, dec(2) append ctitle(Direct)
	margins, dydx(direct) at(dalp=(0(.25)1)) 
	marginsplot, yline(0) ///
		xtitle("Inducing votes with targeted benefits, DALP") ///
		ytitle("Effects on Trust in Elections") ///
		title(Direct Exposure to Vote Buying)
	graph save Graph "fig1dalp_direct.gph", replace
graph combine fig1dalp_direct.gph fig1dalp_indirect.gph, ysize(3) scale(1.4)
graph save a20.gph, replace


**************** A23
tab pais if !missing(trustel, indirect, approval, woman, quintall, agecohort, edr, rural, m1)
tab pais if !missing(trustel, direct, approval, woman, quintall, agecohort, edr, rural, m1) // MEX, GTM, PER, PRY, DOM, JAM
	fre pais // 1, 2, 11, 12, 21, 23
*** quintiles of approval
sum approval if !missing(trustel, indirect, woman, quintall, agecohort, edr, rural, m1), detail // 25%=0, 50%=.25, 75%=.5, 100%=1
	recode approval (0=0 "25%")(.25=1 "50%")(.5=2 "75%")(.75 1=3 "100%"), gen(approval_percentiles)
	lab var approval_percentiles "Approval of Vote Buying, Percentiles"
	
mixed trustel i.indirect##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==1
	margins, dydx(indirect) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Indirect") ytitle("Effects on Trust in Elections")
	graph save Graph "a23_indirect_MEX.gph", replace				
mixed trustel i.direct##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==1
	margins, dydx(direct) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Direct") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_direct_MEX.gph", replace
graph combine a23_direct_MEX.gph a23_indirect_MEX.gph, xsize(8) ysize(4) title("Mexico")
	graph save Graph "a23_MEX.gph", replace
	
	
mixed trustel i.indirect##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==2
	margins, dydx(indirect) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Indirect") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_indirect_GTM.gph", replace				
mixed trustel i.direct##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==2
	margins, dydx(direct) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Direct") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_direct_GTM.gph", replace
graph combine a23_direct_GTM.gph a23_indirect_GTM.gph, xsize(8) ysize(4) title("Guatemala")
	graph save Graph "a23_GTM.gph", replace
	
	
mixed trustel i.indirect##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==11
	margins, dydx(indirect) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Indirect") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_indirect_PER.gph", replace				
mixed trustel i.direct##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==11
	margins, dydx(direct) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Direct") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_direct_PER.gph", replace
graph combine a23_direct_PER.gph a23_indirect_PER.gph, xsize(8) ysize(4) title("Peru")
	graph save Graph "a23_PER.gph", replace
	
	
mixed trustel i.indirect##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==12
	margins, dydx(indirect) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Indirect") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_indirect_PRY.gph", replace				
mixed trustel i.direct##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==12
	margins, dydx(direct) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Direct") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_direct_PRY.gph", replace
graph combine a23_direct_PRY.gph a23_indirect_PRY.gph, xsize(8) ysize(4) title("Paraguay")
	graph save Graph "a23_PRY.gph", replace
	
	
mixed trustel i.indirect##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==21
	margins, dydx(indirect) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Indirect") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_indirect_DOM.gph", replace				
mixed trustel i.direct##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==21
	margins, dydx(direct) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Direct") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_direct_DOM.gph", replace
graph combine a23_direct_DOM.gph a23_indirect_DOM.gph, xsize(8) ysize(4) title("Dominican Republic")
	graph save Graph "a23_DOM.gph", replace
	
	
mixed trustel i.indirect##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==23
	margins, dydx(indirect) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Indirect") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_indirect_JAM.gph", replace				
mixed trustel i.direct##c.approval_percentiles woman quintall agecohort edr rural m1 if pais==23
	margins, dydx(direct) at(approval_percentiles=(0 1 2 3))
	marginsplot, yline(0) title("Direct") ///
		ytitle("Effects on Trust in Elections")
	graph save Graph "a23_direct_JAM.gph", replace
graph combine a23_direct_JAM.gph a23_indirect_JAM.gph, xsize(8) ysize(4) title("Jamaica")
	graph save Graph "a23_JAM.gph", replace
	
	
	
********************************************************************* Appendix analyses for experiment 
cd "../data"

* delete rows 2-14 of qualtrics data set, save as "mex_experiment_cps.csv" and import into stata
import delimited mex_experiment_cps.csv, clear
destring, replace

* keeping only valid observations 
drop if q2!=1 // 33 dropped because no consent
drop if citizenship!=1 // 35 dropped because not Mexican citizens
drop if birth==1 // 2 dropped because not 18/older

* age
replace birth=birth+16
	sum birth // 18-66
gen age=.
	replace age=6 if birth>65
	replace age=5 if birth<66
	replace age=4 if birth<56
	replace age=3 if birth<46
	replace age=2 if birth<36 
	replace age=1 if birth<26
lab define age 1"18-25" 2"26-35" 3"36-45" 4"46-55" 5"56-65" 6"66+"
lab val age age

* gender
recode gender(1=0)(2=1)(3=.), gen(woman)

* education
lab var ed "Education Level"
lab def ed 1"None" 2"Primary" 3"Secondary" 4"University or above"
lab val ed ed

* norms
recode norms1 (1=5)(2=4)(4=2)(5=1)
recode norms2 (1=5)(2=4)(4=2)(5=1)
gen norm=(norms1+norms2)/2
rescale norm 0 1

* DVs
lab var b47a "Trust in elections"
	tab b47a
	replace b47a=b47a-1
lab var b13 "Trust in the Congress"
lab var b20 "Trust in the Catholic Church"
lab var b81 "Trust in the health ministry"

* saturated
lab var exp1c "Seen similar story before"
recode exp1c(2=0)

*speeders
sum durationinseconds if etid!=. | religid!=., detail //Among those who completed the survey, nearly 9 in 10 respondents finished before 2283 seconds. 
	tab durationinseconds if etid!=. | religid!=. // fastest 2.43% categorized as speeders using this cutoff
gen speed=0
replace speed=1 if durationinseconds<427

*creating treatment variable using one of the timer items (only measured for treated)
gen treat=.
replace treat=1 if q78_firstclick!=.
replace treat=0 if q78_firstclick==.

*compliers
note exp1a: "The article is about an individual. What is his name?"
	lab def exp1a 1"Alberto" 2"Álvaro" 3"Agustín" 4"Antonio"
	lab val exp1a exp1a
note exp1b: "Did the story mention campaign rallies?"
	lab def exp1b 1"Yes" 2"No"
	lab val exp1b exp1b
gen comply=0
	replace comply=1 if exp1a==3 | exp1b==2
	replace comply=1 if treat==0
	tab exp1a exp1b if comply==0
	tab exp1a exp1b if comply==1

************** analyses
cd "../figures and tables"

*** B2. balance check (SM presents t-test results only)
hotelling age woman ed etid religid, by(treat) 
// means are different at the .08 level.
// At the .05 level, we can't reject the hypothesis that the means among 
// covariates (age, gender, education, ethnic id, regligious id) 
// are equal for the control and treatment groups.
	recode etid (1=0)(3/7=0)(2=1), gen(mestizo)
	recode religid (2/6=0), gen(catholic)
ttest age, by(treat)
ttest woman, by(treat)
ttest ed, by(treat)
ttest mestizo, by(treat)
ttest catholic, by(treat)

*** B5. Weighted
* recoding age, education to match census categories
gen age2=.
	replace age2=6 if birth>64
	replace age2=5 if birth<65
	replace age2=4 if birth<55
	replace age2=3 if birth<45
	replace age2=2 if birth<35 
	replace age2=1 if birth<25
	tab birth age2
	lab var age2 "age"
	lab define age2 1"18-24" 2"25-34" 3"35-44" 4"45-54" 5"55-64" 6"65+"
	lab val age2 age2
recode ed(1/2=1 "Primary or lower")(3=2 "Secondary")(4=3 "University or above"), gen(ednew)

* creating a single categorical variable by combining gender, age, and education level
egen woman_age2_ed2=group(woman age2 ednew), label

* creating the weight, using proportions calculated from the census data 
ipfweight woman_age2_ed2, gen(weight) val(.0179 .0884 .0063 .0167 .0598 .0232 .0227 .0482 .0182 .0246 .0379 .0134 .0237 .0191 .0099 .0348 .0094 .0063 .0149 .0897 .0077 .0154 .0646 .0265 .0239 .0528 .0203 .0280 .0410 .0143 .0303 .0201 .0088 .0440 .0110 .0043) maxit(100) up(5)

* creating a second weight, examining each factor individually
ipfweight ednew age2 woman, gen(wt2) val(.2968 .5420 .1592 .2259 .2066 .1865 .1594 .1119 .1098 .4815 .5185) maxit(100) up(5)

* table
svyset [pw=weight]
svy: reg b47a treat
	outreg2 using tab2wt1.doc, dec(2) replace keep(treat) stats(coef se pval) ctitle(Full sample)
svy: reg b47a treat if speed==0
	outreg2 using tab2wt1.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(No speeders)
svy: reg b47a treat if exp1c!=1
	outreg2 using tab2wt1.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Unsat)
svy: tab ed if !missing(b47a), count
svy: tab age if !missing(b47a), count
svy: tab woman if !missing(b47a), count	

svyset [pw=wt2] 
svy: reg b47a treat
	outreg2 using tab2wt2.doc, dec(2) replace keep(treat) stats(coef se pval) ctitle(Full sample)
svy: reg b47a treat if speed==0
	outreg2 using tab2wt2.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(No speeders)
svy: reg b47a treat if exp1c!=1
	outreg2 using tab2wt2.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Unsat)
svy: tab ed if !missing(b47a), count
svy: tab age if !missing(b47a), count
svy: tab woman if !missing(b47a), count	


fre norm
	recode norm (0=0 "25%")(.125/.25=1 "50%")(.375/.5=2 "75%")(.625/1=3 "100%"), gen(norm_percentiles)
	lab var norm_percentiles "Approval of Vote Buying, Percentiles"
	
* figure 2, weight1
svyset [pw=weight]
reg b47a c.norm_percentiles##i.treat
	margins, dydx(treat) at(norm_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Full Sample")
	graph save Graph "fig2_full_wt1.gph", replace		
reg b47a c.norm_percentiles##i.treat if exp1c!=1 
	margins, dydx(treat) at(norm_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Unsaturated Sample")
	graph save Graph "fig2_unsat_wt1.gph", replace
graph combine fig2_full_wt1.gph fig2_unsat_wt1.gph, xsize(8) ysize(4) title("")
	graph save Graph "fig2_wt1.gph", replace
	
* figure 2, weight2
svyset [pw=wt2]
svy: reg b47a c.norm_percentiles##i.treat
	margins, dydx(treat) at(norm_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Full Sample")
	graph save Graph "fig2_full_wt2.gph", replace		
svy: reg b47a c.norm_percentiles##i.treat if exp1c!=1 
	margins, dydx(treat) at(norm_percentiles=(0 1 2 3))
	marginsplot, yline(0) ///
		ytitle("Effects on Trust in Elections") ///
		title("Unsaturated Sample")
	graph save Graph "fig2_unsat_wt2.gph", replace
graph combine fig2_full_wt2.gph fig2_unsat_wt2.gph, xsize(8) ysize(4) title("")
	graph save Graph "fig2_wt2.gph", replace


*** B6. excluding non-compliers
reg b47a treat if comply==1
	outreg2 using b6.doc, dec(2) replace keep(treat) stats(coef se pval) ctitle(Full sample)
reg b47a treat if comply==1 & speed==0
	outreg2 using b6.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(No speeders)
reg b47a treat if comply==1 & exp1c!=1
	outreg2 using b6.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Unsaturated sample)


*** B7. unsaturated vs saturated
ttest b47b, by(exp1c)
reg b47a treat
	outreg2 using b7.doc, dec(2) replace ctitle(Full sample, no controls)
reg b47a treat if exp1c!=1
	outreg2 using b7.doc, dec(2) append ctitle(Unsaturated, no controls)
reg b47a treat ed mestizo
	outreg2 using b7.doc, dec(2) append ctitle(Full sample, controls)
reg b47a treat ed mestizo if exp1c!=1
	outreg2 using b7.doc, dec(2) append ctitle(Unsaturated, controls)
	

*** B8. approval, exposure to vb, and trust in elections
reg b47a c.norm##i.treat
	outreg2 using b8.doc, dec(2) replace keep(norm 1.treat 1.treat#c.norm) stats(coef se pval) ctitle(Full sample)
reg b47a c.norm##i.treat if speed==0
	outreg2 using b8.doc, dec(2) append keep(norm 1.treat 1.treat#c.norm) stats(coef se pval) ctitle(No speeders)
reg b47a c.norm##i.treat if exp1c!=1
	outreg2 using b8.doc, dec(2) append keep(norm 1.treat 1.treat#c.norm) stats(coef se pval) ctitle(Unsaturated)


*** B9. approval, exposure to vb, and trust in elections (disaggregated)
rescale norms1 0 1
reg b47a c.norms1##i.treat
outreg2 using b9_1.doc, dec(2) replace keep(norms1 1.treat 1.treat#c.norms1) stats(coef se pval) ctitle(Full sample)
	margins, dydx(treat) at(norms1=(0(.25)1))
	marginsplot, yline(0) xtitle("Approval of Vote Buying (party-centered)") ytitle(Predicted Trust in Elections) title(Full Sample) 
	graph save Graph "b9_1_full.gph", replace
reg b47a c.norms1##i.treat if speed==0
	outreg2 using b9_1.doc, dec(2) append keep(norms1 1.treat 1.treat#c.norms1) stats(coef se pval) ctitle(No speeders)
reg b47a c.norms1##i.treat if exp1c!=1
	outreg2 using b9_1.doc, dec(2) append keep(norms1 1.treat 1.treat#c.norms1) stats(coef se pval) ctitle(Unsaturated)
	margins, dydx(treat) at(norms1=(0(.25)1))
	marginsplot, yline(0) xtitle("Approval of Vote Buying (party-centered)") ytitle(Predicted Trust in Elections) title(Unsaturated Sample)
	graph save Graph "b9_1_unsat.gph", replace
graph combine b9_1_full.gph b9_1_unsat.gph
	graph save Graph "b9_1.gph", replace

rescale norms2 0 1
reg b47a c.norms2##i.treat
outreg2 using b9_2.doc, dec(2) replace keep(norms2 1.treat 1.treat#c.norms2) stats(coef se pval) ctitle(Full sample)
	margins, dydx(treat) at(norms2=(0(.25)1))
	marginsplot, yline(0) xtitle("Approval of Vote Buying (citizen-centered)") ytitle(Predicted Trust in Elections) title(Full Sample)
	graph save Graph "b9_2_full.gph", replace
reg b47a c.norms2##i.treat if speed==0
	outreg2 using b9_2.doc, dec(2) append keep(norms2 1.treat 1.treat#c.norms2) stats(coef se pval) ctitle(No speeders)
reg b47a c.norms2##i.treat if exp1c!=1
	outreg2 using b9_2.doc, dec(2) append keep(norms2 1.treat 1.treat#c.norms2) stats(coef se pval) ctitle(Unsaturated)
	margins, dydx(treat) at(norms2=(0(.25)1))
	marginsplot, yline(0) xtitle("Approval of Vote Buying (citizen-centered)") ytitle(Predicted Trust in Elections) title(Unsaturated Sample)
	graph save Graph "b9_2_unsat.gph", replace	
graph combine b9_2_full.gph b9_2_unsat.gph
	graph save Graph "b9_2.gph", replace


* B12. placebo test with trust in congress, church and health ministry
	* trust in congress
reg b13 treat
	outreg2 using b12.doc, dec(2) replace keep(treat) stats(coef se pval) ctitle(Congress, Full sample)
reg b13 treat if speed==0
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Congress, No speeders)
reg b13 treat if exp1c!=1 
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Congress, Unsaturated)
	* trust in catholic church
reg b20 treat
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Church, Full sample)
reg b20 treat if speed==0
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Church, No speeders)
reg b20 treat if exp1c!=1 
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Church, Unsaturated)
	* trust in health ministry
reg b81 treat
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Health, Full sample)
reg b81 treat if speed==0
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Health, No speeders)
reg b81 treat if exp1c!=1
	outreg2 using b12.doc, dec(2) append keep(treat) stats(coef se pval) ctitle(Health, Unsaturated)

	
*** B10-11 diff-in-diff analyses
gen dv0=b47b
	gen dv1=b47a
	reshape long dv, i(responseid) j(post_treatment)
lab def post_treatment 0"Pre" 1"Post"
	lab val post_treatment post_treatment

* B10 (H1 diff-in-diff) 
reg dv treat##post_treatment
	lincom 1.treat + 1.treat#1.post_treatment
	outreg2 using b10.doc, dec(2) replace ctitle(Full Sample) ///
		keep(1.treat 1.post_treatment 1.treat#1.post_treatment)
reg dv treat##post_treatment if speed==0
	lincom 1.treat + 1.treat#1.post_treatment
	outreg2 using b10.doc, dec(2) append ctitle(No Speeders) ///
		keep(1.treat 1.post_treatment 1.treat#1.post_treatment)
reg dv treat##post_treatment if exp1c!=1
	lincom 1.treat + 1.treat#1.post_treatment
	outreg2 using b10.doc, dec(2)  append ctitle(Unsaturated) ///
		keep(1.treat 1.post_treatment 1.treat#1.post_treatment)
margins treat, at(post_treatment=(0 1))
	marginsplot, xtitle(DV measure) ytitle(Predicted Trust in Elections) title("")
	graph save Graph "b10.gph", replace

	
*  B11 (H2 diff-in-diff) 
reg dv c.norm##i.treat##post_treatment
	lincom 1.treat#1.post_treatment + norm#1.treat#1.post_treatment
	outreg2 using b11.doc, dec(2) replace ctitle(Full Sample) ///
		keep(norm 1.treat 1.treat#c.norm 1.post_treatment 1.post_treatment#c.norm ///
			1.treat#1.post_treatment 1.treat#1.post_treatment#c.norm)	
reg dv c.norm##i.treat##post_treatment if speed==0
	lincom 1.treat#1.post_treatment + norm#1.treat#1.post_treatment
	outreg2 using b11.doc, dec(2) append ctitle(No Speeders) ///
		keep(norm 1.treat 1.treat#c.norm 1.post_treatment 1.post_treatment#c.norm ///
			1.treat#1.post_treatment 1.treat#1.post_treatment#c.norm) 
reg dv c.norm##i.treat##post_treatment if exp1c!=1
	lincom 1.treat#1.post_treatment + norm#1.treat#1.post_treatment
	outreg2 using b11.doc, dec(2) append ctitle(Unsaturated) ///
		keep(norm 1.treat 1.treat#c.norm 1.post_treatment 1.post_treatment#c.norm ///
		1.treat#1.post_treatment 1.treat#1.post_treatment#c.norm)
margins, dydx(post_treatment) at(norm=(0(.25)1) treat=(0 1))
	marginsplot, xtitle(Approval of Vote Buying)
	graph save Graph "b11.gph", replace
	
	
log close
